[field]http://eagle.fish.washington.edu/dermochelys/January2014/DSCF4003.JPG
getwd()
setwd(C:\Users\Christine Savolainen\Desktop\Bio Informatics)
library(ape)
library(ade4)
library(adegenet)
library(diveRsity)
library(doParallel)
library(foreach)
library(genetics)
library(hierfstat)
library(iterators)
library(parallel)
library(sendplot)
library(xlsx)
library(BDgraph)
setwd("C:/Users/Christine Savolainen/Desktop/Bio Informatics/Con Gen")
salmon <- read.genepop("Class_data_genepop_new.gen", missing=NA)
pop_labels <- c(rep("F1998",50),rep("I2002",50),
rep("S2002",50),rep("I2006",50),rep("S2006",50),rep("I2010",50),
rep("S2010",50) )
pop_stats <- fstOnly(infile="Class_data_genepop_FST.txt",outfile="Salmon_Pairwise_Fst",
gp=3,bs_pairwise=TRUE,bootstraps=100,parallel=TRUE)
write.table(pop_stats,file="FSTresults.csv",sep=",",row.names=T)
pairwise_fst <- read.csv("FSTresults.csv",header=TRUE,row.names=1)
pairwise_fst
fst <- as.dist(pairwise_fst) ## Convert pairwise_fst to a distance object
fst  ### we'll use this matrix later in the analysis
genotype_data <- read.csv("INT_SEG_genotypes.csv",header=TRUE)
genotypes <- genotype_data[,2:201]
pop_labels <- c(rep("Founders1998",50),rep("Int2002",50),
rep("Seg2002",50),rep("Int2006",50),rep("Seg2006",50),rep("Int2010",50),
rep("Seg2010",50) )
pops <- as.factor(pop_labels)
genet_file <- char2genet(genotypes,pops,complete=TRUE)
Nei_dist <- dist.genet(genet_file,method=1)
genotype_data <- read.csv("INT_SEG_genotypes.csv",header=TRUE)
genotypes <- genotype_data[,2:201]
pop_labels <- c(rep("Founders1998",50),rep("Int2002",50),
rep("Seg2002",50),rep("Int2006",50),rep("Seg2006",50),rep("Int2010",50),
rep("Seg2010",50) )
pops <- as.factor(pop_labels)
genet_file <- char2genet(genotypes,pops,complete=TRUE)
Nei_dist <- dist.genet(genet_file,method=1)
char2genet??
?
c
??char2genet
genotype_data <- read.csv("INT_SEG_genotypes.csv",header=TRUE)
genotypes <- genotype_data[,2:201]
l
l
pop_labels <- c(rep("Founders1998",50),rep("Int2002",50),
rep("Seg2002",50),rep("Int2006",50),rep("Seg2006",50),rep("Int2010",50),
rep("Seg2010",50) )
pops <- as.factor(pop_labels)
genet_file <- char2genet(genotypes,pops,complete=TRUE)
Nei_dist <- dist.genet(genet_file,method=1)
Nei_dist
genotype_data <- read.csv("INT_SEG_genotypes.csv",header=TRUE)
genotypes <- genotype_data[,1:201]
pop_labels <- c(rep("Founders1998",50),rep("Int2002",50),
rep("Seg2002",50),rep("Int2006",50),rep("Seg2006",50),rep("Int2010",50),
rep("Seg2010",50) )
pops <- as.factor(pop_labels)
e
genet_file <- char2genet(genotypes,pops,complete=TRUE)
genotypes <- genotype_data[,3:201]
pop_labels <- c(rep("Founders1998",50),rep("Int2002",50),
rep("Seg2002",50),rep("Int2006",50),rep("Seg2006",50),rep("Int2010",50),
rep("Seg2010",50) )
pops <- as.factor(pop_labels)
genet_file <- char2genet(genotypes,pops,complete=TRUE)
genotypes <- genotype_data[,2:200]
pops <- as.factor(pop_labels)
genet_file <- char2genet(genotypes,pops,complete=TRUE)
genotype_data <- read.csv("INT_SEGS_genotypes.csv",header=TRUE)
genotypes <- genotype_data[,2:200]
pop_labels <- c(rep("Founders1998",50),rep("Int2002",50),
rep("Seg2002",50),rep("Int2006",50),rep("Seg2006",50),rep("Int2010",50),
rep("Seg2010",50) )
pops <- as.factor(pop_labels)
genet_file <- char2genet(genotypes,pops,complete=TRUE)
genet_file <- char2genet(genotypes,pops,complete=FALSE)
genotypes <- genotype_data[,2:201]
??Genotype
??genotype_data
??read.csv
genotype_data <- read.csv("INT_SEG_genotypes.csv",header=TRUE, sep = ",",comment.char = "")
genotypes <- genotype_data[,2:201]
pop_labels <- c(rep("Founders1998",50),rep("Int2002",50),
rep("Seg2002",50),rep("Int2006",50),rep("Seg2006",50),rep("Int2010",50),
rep("Seg2010",50) )
pops <- as.factor(pop_labels)
genet_file <- char2genet(genotypes,pops,complete=TRUE)
??genet
genotypes <- genotype_data[,1:201]
genet_file <- char2genet(genotypes,pops,complete=TRUE)
genotypes <- genotype_data[,2:201]
genet_file <- char2genet(genotypes,pops,complete=TRUE)
genotype_data <- read.csv("INT_SEG_genotypes.csv",header=TRUE, sep = ",",comment.char = "")
genotypes <- genotype_data[,2:201]
pop_labels <- c(rep("Founders1998",50),rep("Int2002",50),
rep("Seg2002",50),rep("Int2006",50),rep("Seg2006",50),rep("Int2010",50),
rep("Seg2010",50) )
pops <- as.factor(pop_labels)
genet_file <- char2genet(genotypes,pops,complete=TRUE)
genotype_data <- read.csv("INT_SEGSS_genotypes.csv",header=TRUE, sep = ",",comment.char = "")
genotypes <- genotype_data[,2:201]
pop_labels <- c(rep("Founders1998",50),rep("Int2002",50),
rep("Seg2002",50),rep("Int2006",50),rep("Seg2006",50),rep("Int2010",50),
rep("Seg2010",50) )
pops <- as.factor(pop_labels)
genet_file <- char2genet(genotypes,pops,complete=TRUE)
Nei_dist <- dist.genet(genet_file,method=1)
Nei_dist
tree <- nj(Nei_dist)
plot.phylo(tree)
func <- function(x) nj(dist.genet(char2genet(x,pops)))
bootstraps <- boot.phylo(tree,genotypes,func,B=100,block=1,rooted=TRUE)
plot.phylo(tree)
nodelabels(bootstraps)
bootstraps
pcoa<-dudi.pco(Nei_dist,scannf=FALSE,nf=2)
pcoa$eig
scatter(pcoa,xax=1,yax=2,clab.row=1,posieig="topright")
variance_explained1<-pcoa$eig[1]/sum(pcoa$eig)
variance_explained1
variance_explained2<-pcoa$eig[2]/sum(pcoa$eig)
variance_explained2
View(pairwise_fst)
View(genotypes)
View(genotype_data)
View(genotypes)
View(pairwise_fst)
View(pairwise_fst)
save.image("C:/Users/Christine Savolainen/Desktop/Bio Informatics/Con Gen/salmonanalysis2.RData")
